const express = require('express')
const app = express()

app.use(
  '/api',
  (req, res, next) => {
    console.log('API路由中间件')
    next()
  },
  (req, res, next) => {
    console.log('可以写多个函数1')
    next()
  },
  (req, res, next) => {
    console.log('可以写多个函数2')
    next()
  }
)

app.get('/', async (req, res, next) => {
  res.json({ data: 'get /' })
})

app.listen(3000, () => {
  console.log(`Server running at http://localhost:3000/`)
})
